function plotCascading(startingParams, scales, ImgSetList, PlotIdx)

if ischar(ImgSetList), ImgSetList = {ImgSetList}; end

%%
for scale = scales
    s_scale = ['s' num2str(scale)];
    NetList = srmodel.getNetList(scale, startingParams);
    for ni = 1 : length(NetList)
        Net = NetList{ni};
        
        Net = srmodel.formatNetParam(Net);
        MatFile = sranaly.getOutputFile(Net);
        clear results0 results1
        load(MatFile);
        if ~exist('results1', 'var'), continue; end
        
        Net = srmodel.parseNetParam(Net);
        
        for si = 1 : length(ImgSetList)
            ImgSet = ImgSetList{si};
            if ~isfield(results1, ImgSet), continue; end
            for ai = 1 : length(Net.alias_names)
                net_name = Net.alias_names{ai};
                psnr_bar = mean(results1.(ImgSet){ai, 1});
                ssim_bar = mean(results1.(ImgSet){ai, 2});
                iters = results1.(ImgSet){ai, end};
                AllResults.(s_scale).(ImgSet).(net_name) = {psnr_bar, ssim_bar, iters};
                % sranaly.printMaxPSNR(Net.alias_names, results1);
            end
        end
    end
end

%%
scales = fieldnames(AllResults);
scales = cellfun(@(x)eval(x(end)), scales);
for scale = scales
    s_scale = ['s' num2str(scale)];
    ImgSetList = fieldnames(AllResults.(s_scale));
    for k = PlotIdx
        for si = 1 : length(ImgSetList)
            figure;
            ImgSet = ImgSetList{si};
            st = AllResults.(s_scale).(ImgSet);
            NetNameList = fieldnames(st);
            for ni = 1 : length(NetNameList)
                Net = NetNameList{ni};
                mean_quality = st.(Net){:, k};
                iters = st.(Net){:, end};
                
                iters = iters / 2000;
                bool = floor(iters) == iters;
                iters = iters(bool);
                if strcmp(Net, 'VDSR_Bicubic_MSRA')
                    plot(iters, mean_quality(bool), '-o'); hold on
                else
                    plot(iters, mean_quality(bool)); hold on
                end
            end
            h = legend(NetNameList);
            h.Interpreter = 'none';
            h.Location = 'southeast';
            axis tight
            ylim = get(gca, 'ylim');
            % ylim(2) = ylim(2) + .05;
            set(gca, 'ylim', ylim);
            xlim = get(gca, 'xlim');
            set(gca, 'xtick', [1 5 : 5 : xlim(end)])
            title(sprintf('%s, Scale = %d', ImgSet, scale));
            grid on
        end
    end
end


